home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / cli / mx2src.arc / ACC.MOD next >
Text File  |  1989-01-05  |  3KB  |  75 lines

  1.  
  2. (*              Copyright 1987,1988 fred brooks LogicTek        *)
  3. (*                                                              *)
  4. (*                                                              *)
  5. (*   First Release                      12/8/87-FGB             *)
  6. (* Added code to tell the context switcher the value of the     *)
  7. (* ACC Super Stack to help it with multitasking gem programs    *)
  8. (*                                      3/9/88-FGB              *)
  9. (*                                                              *)
  10.  
  11. MODULE acc;
  12. (*$T-,$S-*)
  13. FROM ATOMIC          IMPORT VERSION;
  14. FROM SYSTEM          IMPORT ADDRESS,ADR;
  15. FROM GEMDOS          IMPORT Super,ConOut;
  16. FROM AESApplications IMPORT ApplInitialise;
  17. FROM AESMenus        IMPORT MenuRegister;
  18. FROM AESEvents       IMPORT EventMultiple;
  19. FROM GEMAESbase      IMPORT AccessoryOpen;
  20. FROM AESForms        IMPORT FormAlert;
  21.  
  22. VAR
  23.   applID                            : INTEGER;  (* desk application ID *)
  24.   menuID,waittime                   : INTEGER;  (* menu ID *)
  25.   Msg                               : ARRAY [0..16] OF INTEGER;
  26.   handle, events, x,emask,b         : INTEGER;
  27.   ssv,stacksave                     : ADDRESS;
  28.   superstack [144H]                 : ADDRESS;
  29.   mx2run                            : BOOLEAN;
  30.  
  31.  
  32. BEGIN
  33.   (* initialise application & install desk accessory *)
  34.   applID := ApplInitialise();
  35.   menuID := MenuRegister(applID,VERSION);
  36.   emask:=48; (* timer and message *)
  37.   waittime:=10000; (* check every 10 seconds to see if mx2 is running *)
  38.   mx2run:=FALSE;
  39.  
  40.   ssv:=0;
  41.   Super(ssv);           (* in super mode *)
  42.   superstack:=ssv;      (* save superstack value for context switcher *)
  43.   stacksave:=ssv;
  44.   Super(ssv);           (* return to gem stack space *)
  45.   LOOP
  46.     events := EventMultiple(emask,0,0,0,
  47.                             0,0,0,0,0,
  48.                             0,0,0,0,0,
  49.                             ADR(Msg),
  50.                             waittime,0,
  51.                             x,x,x,x,
  52.                             x,x);
  53.   IF NOT mx2run THEN
  54.      ssv:=0;
  55.      Super(ssv);           (* in super mode *)
  56.      IF superstack#stacksave THEN
  57.         waittime:=0; (* set timer to zero *)
  58.         mx2run:=TRUE;
  59.      END;
  60.      Super(ssv);           (* return to gem stack space *)
  61.   END;
  62.   IF Msg[0]=AccessoryOpen THEN
  63.         IF emask=48 THEN b:=1 ELSE b:=2 END;
  64.         ConOut(7c);
  65.         x:=FormAlert(b,"[2][Fred Brooks LogicTek| |     Switch|MX2 Desk Accessory][ON|OFF]");
  66.         Msg[0]:=0;
  67.         IF x=1 THEN
  68.            emask:=48; (* message and timer *)
  69.         ELSE
  70.            emask:=16; (* just message *)
  71.         END;
  72.   END;
  73.   END;
  74. END acc.
  75.